<?php
header("Content-type: text/json; charset=utf-8");
$cookie='pgv_pvid=493843638; eas_sid=X1k5s345m3T5p7u54076u5e7f0; tvfe_boss_uuid=ffe50d332b72587f; pgv_pvi=1192231936; RK=QtT1nhGwPF; ptcz=bb1de079a05e4888e6e191b696426b8bc75849f1ff3cd20eeb17707a93e487f6; webwxuvid=2b9b1e84b0820a72c25b1bfeb3ba8611146815858c06d597c69ff1d71effb40f93f00275956b89c981dbd2e7b4dff7f2; o_cookie=569048849; LW_sid=N1N5u3t9J5r9l3o919W0A6C2S6; LW_uid=p1i5o3A9a5J9T369K9T0W6d2U7; pac_uid=1_569048849; _ga=GA1.2.1467215094.1542456428; mobileUV=1_169afce13c7_edda5; pgv_si=s1390559232; pgv_info=ssid=s2623541178; mm_lang=zh_CN; MM_WX_NOTIFY_STATE=1; MM_WX_SOUND_STATE=1; wxuin=403106795; wxsid=rrqd7qTT3odm8nFZ; webwx_data_ticket=gSfOWEg8Ziz/xXQ81F/Ry3Ny; webwx_auth_ticket=CIsBEIHS3NQLGoABbq9A7k50ZFTGQGJ1RQel5HOf+Dp1OATErc92BIOLzcV047MHRfVo/U9oUGppQe9UewltxwEI6dS7yNakaRTA5nb9M8C/uXB3HE3WK3hfUAxtD4cJFxSVJC4fqQ55Ue1nzu7EoFRia1LOsnUOnP41KtA+XgU61tdncu9DfHwVc68=; login_frequency=1; last_wxuin=403106795; wxloadtime=1554958120_expired; wxpluginkey=1554940278';
//获取方式-》登录微信web版获得
if (isset($_GET['url'])) {
	function CheckUrl($C_url) {
		$str =
"/^(?:[A-za-z0-9-]+\.)+[A-za-z]{2,4}(?:[\/\?#][\/=\?%\-&~`@[\]\':+!\.#\w]*)?$/";
		if (!preg_match($str, $C_url)) {
			return false;
		} else {
			return true;
		}
	}
	$url22 = urldecode($_GET['url']);
	if (!CheckUrl($url22)) {
		echo '{"res":"-1","content":' . json_encode(
						 "域名格式不正确") . '}';
	} else {
		
		
		
		function send_post($url2) {
	
			$options = array(
			
				'http' => array(
		
					'method'  => 'GET',
					'header'  => 'Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding:gzip, deflate, br
Accept-Language:zh-CN,zh;q=0.8
Connection:keep-alive
Cookie:'.$cookie.'
Host:wx.qq.com
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1'
									      ,
					'timeout' => 15 * 60 // 超时时间（单位:s）

				)
			);
			$context      = stream_context_create($options);
			$rrrs         = file_get_contents($url2, false,
								     $context);
			$responseInfo = $http_response_header;
			return $responseInfo;
		}
		
		//使用方法
		$rst    = send_post(
  'https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxcheckurl?requrl=https%3A%2F%2F' .
								       $url22);
                                       //wx.还是wx2.根据实际账号情况使用
							   
									  
		$jieguo = json_encode($rst);

		$str2 =
'weixin110.qq.com\/cgi-bin\/mmspamsupport-bin\/newredirectconfirmcgi?main_type=2'
									      ;
		//strpos 大小写敏感  stripos大小写不敏感    两个函数都是返回
		if (stripos($jieguo, $str2) === false) { //使用绝对等于

			echo '{"msg":"正常访问","statu":"true","url":"http:\/\/47.99.174.54\/api\/wxcheck","code":"1001"}';
		} else {
			echo '{"msg":"已被封禁","statu":"false","url":"http:\/\/47.99.174.54\/api\/wxcheck","code":"1002"}';
		}
	}
} else {
	echo '{"res":"0","content":' . json_encode("无输入项") . '}';
}

//出现weixin110说明域名有问题
?>